<template>
  <div>
    <div
      class="read-box"
      :class="readTheme"
      :style="infoFlag?'filter:blur(4px)':''"
      @click="handleToCloseInfo"
    >
      <div class="read-content" v-loading="boxFlag">
        <div class="content-header">
          <div class="header-title">{{chapterTitle}}</div>
          <div class="header-percentage">{{chapterPercentage}}%</div>
          <div class="header-tools">
            <svg-icon
              :icon-class="readTheme+'_last_chapter'"
              @click="handleToPrePage"
              style="margin-right:4px;"
            />
            <svg-icon
              :icon-class="readTheme+'_next_chapter'"
              @click="handleToNextPage"
              style="margin-right:6px;"
            />
            <span style="position:relative;bottom:2px;">|</span>
            <svg-icon
              :icon-class="readTheme + (contentShow?'_open_menu':'_close_menu')"
              @click="handleToChapterList"
              style="margin-left:6px;"
            />
          </div>
        </div>
        <div
          key="content"
          v-show="contentShow"
          ref="contentMain"
          @scroll="scrollView"
          class="content-main"
        >
          <div
            class="content-item"
            v-for="(item, index) in contentList"
            :key="index"
            :id="'item-'+index"
          >
            <div class="content-title">
              <div class="title-name">{{item.title}}</div>
              <div class="title-count">本章共 {{item.content.length}} 字</div>
            </div>
            <div
              class="content-detail"
              :style="'font-size:' + fontSize + 'px'"
              v-html="item.content"
            ></div>
            <div class="content-footer">
              <svg-icon :icon-class="readTheme + '_read_footer_icon'"></svg-icon>
            </div>
          </div>
        </div>
        <div
          key="chapter"
          v-show="!contentShow"
          class="content-main"
          :style="infoFlag?'overflow:hidden':''"
        >
          <div class="content-title">
            <div class="title-name">目录</div>
            <div class="title-count">共计 {{chapterCount}} 章节</div>
          </div>
          <div class="content-detail">
            <span
              class="content-chapter"
              :class="(index + 1) == chapterData.index ?'active':''"
              v-for="(item, index) in chapterList"
              :key="index"
              :id="'chapter-'+ (index + 1)"
              @click="handleToCurrentChapter(item.id)"
            >{{item.title}}</span>
          </div>
        </div>
      </div>
      <div class="read-tools">
        <el-tooltip class="item" :effect="readTheme" content="收藏" placement="right">
          <svg-icon
            :icon-class="readTheme + (isCollect ?'_read_collected':'_read_collect')"
            @click="handleToCollect"
          />
        </el-tooltip>
        <el-tooltip class="item" :effect="readTheme" content="主题模式" placement="right">
          <svg-icon :icon-class="readTheme+'_theme'" @click="handleChangeTheme" />
        </el-tooltip>
        <el-tooltip class="item" :effect="readTheme" content="翻页模式" placement="right">
          <svg-icon
            :icon-class="pageMode?readTheme+'_scroll_page_up_to_down':readTheme+'_scroll_page_right_to_left'"
            @click="handleChangePageMode"
          />
        </el-tooltip>
        <el-tooltip class="item" :effect="readTheme" content="字号" placement="right">
          <svg-icon :icon-class="readTheme+'_font_' + fontSize" @click="handleChangeFontSize" />
        </el-tooltip>
        <el-tooltip class="item" :effect="readTheme" content="说明" placement="right">
          <svg-icon :icon-class="readTheme+'_read_info'" @click.stop="handleToShowInfo" />
        </el-tooltip>
        <el-tooltip class="item" :effect="readTheme" content="退出阅读" placement="right">
          <svg-icon :icon-class="readTheme+'_read_quit'" @click="handleQuit" />
        </el-tooltip>
      </div>
    </div>
    <div class="read-tools" :class="readTheme" v-show="infoFlag" @click="handleToCloseInfo">
      <div class="tools-item">
        <svg-icon :icon-class="readTheme+'_read_collect'" />
        <span :style="readTheme=='light'?'':'color:rgba(210,219,255,0.55)'">收藏</span>
      </div>
      <div class="tools-item">
        <svg-icon :icon-class="readTheme+'_theme'" />
        <span :style="readTheme=='light'?'':'color:rgba(210,219,255,0.55)'">主题模式</span>
      </div>
      <div class="tools-item">
        <svg-icon
          :icon-class="pageMode?readTheme+'_scroll_page_up_to_down':readTheme+'_scroll_page_right_to_left'"
        />
        <span :style="readTheme=='light'?'':'color:rgba(210,219,255,0.55)'">翻页模式</span>
      </div>
      <div class="tools-item">
        <svg-icon :icon-class="readTheme+'_font_' + fontSize" />
        <span :style="readTheme=='light'?'':'color:rgba(210,219,255,0.55)'">字号</span>
      </div>
      <div class="tools-item">
        <svg-icon :icon-class="readTheme+'_read_info'" />
        <span :style="readTheme=='light'?'':'color:rgba(210,219,255,0.55)'">说明</span>
      </div>
      <div class="tools-item">
        <svg-icon :icon-class="readTheme+'_read_quit'" />
        <span :style="readTheme=='light'?'':'color:rgba(210,219,255,0.55)'">退出阅读</span>
      </div>
    </div>
    <div
      class="header-tools-outside"
      v-show="infoFlag"
      @click="handleToCloseInfo"
      :style="readTheme=='light'?'':'border:1px solid rgba(210,219,255,0.45)'"
    >
      <svg-icon :icon-class="readTheme+'_last_chapter'" style="margin-right:4px;" />
      <svg-icon :icon-class="readTheme+'_next_chapter'" style="margin-right:6px;" />
      <span style="position:relative;bottom:2px;">|</span>
      <svg-icon
        :icon-class="readTheme + (contentShow?'_open_menu':'_close_menu')"
        style="margin-left:6px;"
      />
    </div>
    <div class="header-tools-info" v-show="infoFlag" @click="handleToCloseInfo">
      <span :style="readTheme=='light'?'':'color:rgba(210,219,255,0.55)'">左：上一章</span>
      <span :style="readTheme=='light'?'':'color:rgba(210,219,255,0.55)'">中：上一章</span>
      <span :style="readTheme=='light'?'':'color:rgba(210,219,255,0.55)'">右：目录</span>
    </div>
  </div>
</template>

<script>
import { getRead } from "@/api/read";
import { getChapterAllList } from "@/api/chapter";
import { bookShelfList, addBookShelf, delBookShelf } from "@/api/shelf";
const moment = require("moment");
moment.locale("zh-cn");
export default {
  name: "readcard",
  props: {
    id: [String, Number],
    chapterId: [String, Number],
  },
  data() {
    return {
      chapterData: {},
      chapterList: [],
      contentList: [],
      chapterCount: 0,
      chapterTitle: "",
      chapterPercentage: 0,
      boxFlag: true,
      percentage: 0.0,
      fontSize: 16,
      contentShow: true,
      readTheme: "light",
      nextChapterFlag: true,
      currentChapter: 0,
      pageMode: true,
      infoFlag: false,
      isCollect: false,
      book_shelf_id:0
    };
  },
  created() {
    this.getChapterList();
    this.init();
  },
  watch: {
    currentChapter(val) {
      this.chapterTitle = this.contentList[val].title;
      this.chapterPercentage = Number(
        (this.contentList[val].index / this.chapterCount) * 100
      ).toFixed(1);
      let chapterId = this.chapterList[this.contentList[val].index - 1].id;
      if (window.localStorage.getItem("recently_read")) {
        let recentlyRead = JSON.parse(
          window.localStorage.getItem("recently_read")
        );
        if (
          recentlyRead.filter((item) => item.id == this.$route.query.id)
            .length > 0
        ) {
          // 有该文章的阅读记录，修改
          recentlyRead.forEach((item) => {
            if (item.id == this.$route.query.id) {
              item.chapterId = chapterId;
              item.lastReadTime = moment().format("YYYY-MM-D h:mm");
            }
          });
          window.localStorage.setItem(
            "recently_read",
            JSON.stringify(recentlyRead)
          );
        } else {
          // 没有该文章的阅读记录，添加
          recentlyRead.push({
            id: this.$route.query.id,
            chapterId,
            lastReadTime: moment().format("YYYY-MM-D h:mm"),
          });
          window.localStorage.setItem(
            "recently_read",
            JSON.stringify(recentlyRead)
          );
        }
      } else {
        let id = this.$route.query.id;
        let current = {
          id,
          chapterId,
          lastReadTime: moment().format("YYYY-MM-D h:mm"),
        };
        let recentlyRead = JSON.stringify([current]);
        window.localStorage.setItem("recently_read", recentlyRead);
      }
    },
  },
  methods: {
    // 初始化
    async init() {
      await this.getReadContent();
      await this.getBookShelf();
      await this.getReadSetting();
    },
    // 获取设置
    getReadSetting() {
      return new Promise((resolve, reject) => {
        if (window.localStorage.getItem("read_setting")) {
          let readSetting = JSON.parse(
            window.localStorage.getItem("read_setting")
          );
          this.fontSize = readSetting.fontSize;
          this.readTheme = readSetting.readTheme;
          resolve("ok");
        } else {
          reject("error");
        }
      });
    },
    // 获取阅读内容
    getReadContent() {
      return new Promise((resolve, reject) => {
        getRead({ id: this.id, chapter_id: this.chapterId })
          .then((res) => {
            this.contentList.push(res.data);
            this.chapterData = res.data;
            this.chapterTitle = res.data.title;
            this.chapterPercentage = Number(
              (res.data.index / this.chapterCount) * 100
            ).toFixed(1);
            this.boxFlag = false;
            resolve("ok");
          })
          .catch((error) => {
            console.log(error);
            this.boxFlag = false;
            this.$router.push({
              path: "/homepage",
            });
            reject(error);
          });
      });
    },
    // 获取书架
    getBookShelf() {
      return new Promise((resolve, reject) => {
        if (this.$store.state.user.loginStatus) {
          const headers = {
            Authorization: `Bearer ${this.$store.state.user.token}`,
          };
          bookShelfList(headers)
            .then((res) => {
              if (res.data.bookList.length > 0) {
                res.data.bookList.forEach((item) => {
                  if (item.book_id == this.chapterData.id) {
                    this.isCollect = true;
                    this.book_shelf_id = item.book_shelf_id;
                  }
                });
              }
              resolve("ok");
            })
            .catch((e) => {
              console.log(e);
              reject(e);
            });
        } else {
          resolve("not login");
        }
      });
    },
    // 获取下一章内容
    getNextReadContent() {
      if (this.chapterData.next_chapterId == 0) {
        this.$message("已经到最后一章了");
        return;
      }
      getRead({
        id: this.id,
        chapter_id: this.chapterData.next_chapterId,
      }).then((res) => {
        this.contentList.push(res.data);
        this.chapterData = res.data;
        this.nextChapterFlag = true;
      });
    },
    // 获取章节列表
    getChapterList() {
      return new Promise((resolve, reject) => {
        getChapterAllList({ id: this.$route.query.id })
          .then((res) => {
            this.chapterList = res.data.chapterList;
            this.chapterCount = res.data.chapterList.length;
            resolve("ok");
          })
          .catch((e) => {
            reject(e);
          });
      });
    },
    // 阅读区域滚动
    scrollView() {
      let percentage =
        this.$refs.contentMain.scrollTop /
        (this.$refs.contentMain.scrollHeight -
          this.$refs.contentMain.offsetHeight);
      this.percentage = Number(percentage * 100).toFixed(1);
      if (this.percentage >= 80) {
        if (this.nextChapterFlag) {
          this.getNextReadContent();
          this.nextChapterFlag = false;
        }
      }
      this.getCurrentChapter();
    },
    // 获取当前可视区域的章节信息
    getCurrentChapter() {
      let bottom = document
        .querySelector("#item-" + this.currentChapter)
        .getBoundingClientRect().bottom;
      let height = document
        .querySelector("#item-" + this.currentChapter)
        .getBoundingClientRect().height;
      if (bottom < 0) {
        this.currentChapter = this.currentChapter + 1;
      } else if (bottom > height) {
        this.currentChapter = this.currentChapter - 1;
      }
    },
    // 下一章
    handleToNextPage() {
      if (this.chapterData.next_chapterId != 0) {
        this.$router.push({
          path: "/read",
          query: {
            id: this.chapterData.id,
            chapter_id: this.chapterData.next_chapterId,
          },
        });
      } else {
        this.$message("已经到最后一章了");
      }
    },
    //  上一章
    handleToPrePage() {
      if (this.chapterData.last_chapterId != 0) {
        this.$router.push({
          path: "/read",
          query: {
            id: this.chapterData.id,
            chapter_id: this.chapterData.last_chapterId,
          },
        });
      } else {
        this.$message("已经到第一章了");
      }
    },
    // 跳转指定章节
    handleToCurrentChapter(id) {
      this.$router.push({
        path: "/read",
        query: {
          id: this.chapterData.id,
          chapter_id: id,
        },
      });
    },
    // 改变字号
    handleChangeFontSize() {
      this.fontSize =
        this.fontSize === 14 ? 16 : this.fontSize === 16 ? 18 : 14;
      if (window.localStorage.getItem("read_setting")) {
        let readSetting = JSON.parse(
          window.localStorage.getItem("read_setting")
        );
        readSetting.fontSize = this.fontSize;
        readSetting.readTheme = this.readTheme;
        window.localStorage.setItem(
          "read_setting",
          JSON.stringify(readSetting)
        );
      } else {
        let readSetting = {
          fontSize: this.fontSize,
          readTheme: this.readTheme,
        };
        window.localStorage.setItem(
          "read_setting",
          JSON.stringify(readSetting)
        );
      }
    },
    // 章节列表
    handleToChapterList() {
      this.contentShow = !this.contentShow;
      if (!this.contentShow) {
        setTimeout(() => {
          let currentChapter = document.querySelector(
            "#chapter-" + this.chapterData.index
          );
          currentChapter.scrollIntoView({
            behavior: "smooth",
            block: "center",
          });
        }, 500);
      }
    },
    // 说明
    handleToShowInfo() {
      if (!this.infoFlag) {
        this.infoFlag = true;
      }
    },
    handleToCloseInfo() {
      if (this.infoFlag) {
        this.infoFlag = false;
      }
    },
    // 退出阅读
    handleQuit() {
      this.$router.push({
        path: "/chapter",
        query: { id: this.$route.query.id },
      });
    },
    // 切换主题
    handleChangeTheme() {
      if (this.readTheme === "light") {
        this.readTheme = "dark";
      } else {
        this.readTheme = "light";
      }
      if (window.localStorage.getItem("read_setting")) {
        let readSetting = JSON.parse(
          window.localStorage.getItem("read_setting")
        );
        readSetting.fontSize = this.fontSize;
        readSetting.readTheme = this.readTheme;
        window.localStorage.setItem(
          "read_setting",
          JSON.stringify(readSetting)
        );
      } else {
        let readSetting = {
          fontSize: this.fontSize,
          readTheme: this.readTheme,
        };
        window.localStorage.setItem(
          "read_setting",
          JSON.stringify(readSetting)
        );
      }
    },
    // 切换翻页模式
    handleChangePageMode() {
      this.pageMode = !this.pageMode;
    },
    handleToCollect() {
      if (this.$store.state.user.loginStatus) {
        const headers = {
          Authorization: `Bearer ${this.$store.state.user.token}`,
        };
        if (this.isCollect) {
          delBookShelf({ bookShelfId: this.book_shelf_id }, headers).then(
            (res) => {
              if (res.code == 200) {
                this.$message({
                  type: "success",
                  message: "移除书架成功",
                });
              } else {
                this.$message.error(res.msg);
              }
            }
          );
        } else {
          addBookShelf({ bookId: this.$route.query.id }, headers).then(
            (res) => {
              if (res.code == 200) {
                this.$message({
                  type: "success",
                  message: "添加书架成功",
                });
              } else {
                this.$message.error(res.msg);
              }
            }
          );
        }
        this.isCollect = !this.isCollect;
      } else {
        this.$message.error("您还未登陆!");
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.light {
  width: 100%;
  background: rgba(255, 237, 217, 0.65);
  .read-content {
    width: 960px;
    background: #fff9f2;
    box-shadow: 0px 2px 25px 3px rgba(255, 231, 204, 0.36);
    margin: 0 auto;
    padding: 0 102px;
    user-select: none;
    .content-header {
      z-index: 10;
      padding-top: 16px;
      font-size: 14px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: rgba(52, 43, 41, 0.45);
      display: flex;
      justify-content: space-between;
      margin-bottom: 48px;
      border-bottom: 1px transparent solid;
      border-image: linear-gradient(
          90deg,
          rgba(255, 231, 203, 0.15),
          rgba(52, 43, 41, 0.15),
          rgba(255, 231, 204, 0.15)
        )
        100;
      position: fixed;
      width: 756px;
      height: 56px;
      background: #fff9f2;
      .header-title {
        width: 33%;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .header-percentage {
        width: 33%;
        text-align: center;
      }
      .header-tools {
        width: 33%;
        text-align: right;
      }
    }
    .content-main {
      height: 100vh;
      overflow: scroll;
      scrollbar-width: none;
      animation: ease-in-out 1.2s;
      .content-title {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        font-family: Microsoft YaHei;
        font-weight: 600;
        padding-bottom: 44px;
        border-bottom: 1px transparent solid;
        border-image: linear-gradient(
            to right,
            rgba(52, 43, 41, 0.25) 0%,
            rgba(6, 27, 65, 0)
          )
          100;
        padding-top: 92px;
        .title-name {
          font-size: 24px;
          color: rgba(52, 43, 41, 0.95);
          margin-bottom: 12px;
        }
        .title-count {
          font-size: 12px;
          color: rgba(52, 43, 41, 0.45);
        }
      }
      .content-detail {
        line-height: 32px;
        text-align: left;
        padding-bottom: 60px;
        color: rgb(53, 44, 42);
        opacity: 0.65;
        .content-chapter {
          display: block;
          width: 50%;
          float: left;
          font-size: 14px;
          font-family: Microsoft YaHei;
          font-weight: 400;
          color: rgba(53, 44, 42, 0.45);
          line-height: 30px;
          cursor: pointer;
          margin-bottom: 20px;
        }
      }
      .content-footer {
        height: 70px;
        border-bottom: 1px transparent solid;
        border-image: linear-gradient(
            to left,
            rgba(52, 43, 41, 0.25) 0%,
            rgba(6, 27, 65, 0)
          )
          100;
        display: flex;
        justify-content: flex-end;
        .svg-icon {
          font-size: 70px;
          opacity: 0.95;
        }
      }
    }
  }
  .read-tools {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 16px;
    left: 50%;
    margin-left: 500px;
    align-items: center;
  }
}

.dark {
  width: 100%;
  background: #0c0e14;
  .read-content {
    width: 960px;
    background: rgba(16, 18, 26, 1);
    box-shadow: 0px 2px 40px 4px rgba(12, 14, 20, 0.28);
    margin: 0 auto;
    padding: 0 102px;
    user-select: none;
    .content-header {
      z-index: 10;
      padding-top: 16px;
      font-size: 14px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: rgba(52, 43, 41, 0.45);
      display: flex;
      justify-content: space-between;
      margin-bottom: 48px;
      border-bottom: 1px transparent solid;
      border-image: linear-gradient(
          90deg,
          rgba(25, 27, 32, 0.08),
          rgba(217, 225, 255, 0.08),
          rgba(255, 231, 204, 0.08)
        )
        100;
      position: fixed;
      width: 756px;
      height: 56px;
      background: #10131c;
      .header-title {
        width: 33%;
        text-align: left;
        color: rgba(210, 219, 255, 0.35);
      }
      .header-percentage {
        width: 33%;
        text-align: center;
        color: rgba(210, 219, 255, 0.35);
      }
      .header-tools {
        width: 33%;
        text-align: right;
      }
    }
    .content-main {
      height: 100vh;
      overflow: scroll;
      .content-title {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        font-family: Microsoft YaHei;
        font-weight: 600;
        padding-bottom: 44px;
        border-bottom: 1px transparent solid;
        border-image: linear-gradient(
            to right,
            rgba(217, 225, 255, 0.15) 0%,
            rgba(217, 225, 255, 0)
          )
          100;
        padding-top: 92px;
        .title-name {
          font-size: 24px;
          color: rgba(210, 219, 255, 0.85);
          margin-bottom: 12px;
        }
        .title-count {
          font-size: 12px;
          color: rgba(210, 219, 255, 0.35);
        }
      }
      .content-detail {
        text-align: left;
        opacity: 0.55;
        line-height: 32px;
        padding-bottom: 60px;
        color: rgb(210, 219, 255);
        .content-chapter {
          display: block;
          width: 50%;
          float: left;
          font-size: 14px;
          font-family: Microsoft YaHei;
          font-weight: 400;
          color: rgba(210, 219, 255, 0.55);
          line-height: 30px;
          cursor: pointer;
          margin-bottom: 20px;
        }
      }
      .content-footer {
        height: 70px;
        border-bottom: 1px transparent solid;
        border-image: linear-gradient(
            to left,
            rgba(217, 225, 255, 0.15) 0%,
            rgba(217, 225, 255, 0)
          )
          100;
        display: flex;
        justify-content: flex-end;
        .svg-icon {
          font-size: 70px;
          opacity: 0.95;
        }
      }
    }
  }
  .read-tools {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 16px;
    left: 50%;
    margin-left: 500px;
    align-items: center;
  }
}

@keyframes ease-in-out {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@-moz-keyframes ease-in-out {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@-webkit-keyframes ease-in-out {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.content-main::-webkit-scrollbar {
  display: none;
}

.light {
  .content-header::after {
    content: "";
    width: 756px;
    height: 24px;
    background: linear-gradient(
      180deg,
      rgba(255, 249, 242, 1) 0%,
      rgba(255, 249, 242, 0) 100%
    );
    position: fixed;
    top: 46px;
  }
}

.dark {
  .content-header::after {
    content: "";
    width: 756px;
    height: 24px;
    background: linear-gradient(
      180deg,
      rgba(16, 18, 26, 1) 0%,
      rgba(16, 18, 26, 0) 100%
    );
    position: fixed;
    top: 46px;
  }
}

.read-tools .el-button + .el-button {
  margin-left: 0;
  margin-top: 20px;
}

.content-chapter::before {
  content: "";
  width: 10px;
  height: 10px;
  display: inline-block;
  border: 2px solid rgba(52, 43, 41, 0.45);
  border-radius: 20px;
  margin-right: 12px;
}

.content-chapter:hover {
  color: #92c8ff !important;
}

.v-enter,
.v-leave-to {
  opacity: 0;
}

.v-enter-active,
.v-leave-active {
  transition: all 0.2s;
}

.v-enter {
  transform: translateX(30px);
}

.v-leave-active {
  transform: translateX(-30px);
}

.content-detail {
  .active {
    color: rgba(53, 44, 42, 0.95) !important;
  }
}

.read-box {
  .svg-icon {
    font-size: 20px;
    opacity: 0.45;
    cursor: pointer;
  }
}

.read-tools {
  height: calc(100% - 32px);
  .svg-icon {
    font-size: 24px;
    opacity: 0.65;
    cursor: pointer;
    margin-bottom: 20px;
  }
  .svg-icon:last-child {
    position: absolute;
    bottom: 0;
    margin-bottom: 0;
  }
}

.content-detail {
  .content-chapter:nth-child(1) {
    margin-top: 36px;
  }
  .content-chapter:nth-child(2) {
    margin-top: 36px;
  }
}

.read-tools {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 16px;
  left: 50%;
  margin-left: 500px;
  align-items: flex-start;
  .tools-item {
    display: flex;
    span {
      font-size: 12px;
      font-family: Microsoft YaHei;
      font-weight: 600;
      color: rgba(53, 44, 42, 0.65);
      line-height: 24px;
      margin-left: 14px;
    }
  }
  .tools-item:last-child {
    position: absolute;
    bottom: 0;
    svg {
      margin-bottom: 0;
    }
  }
}

.header-tools-outside {
  position: absolute;
  top: 7px;
  left: 50%;
  z-index: 10;
  color: rgba(52, 43, 41, 0.45);
  font-size: 20px;
  opacity: 0.45;
  margin-left: 280px;
  border-radius: 20px;
  border: 1px solid rgba(52, 43, 41, 0.45);
  padding: 7px 16px;
}

.header-tools-info {
  position: absolute;
  top: 7px;
  left: 50%;
  z-index: 10;
  margin-left: 410px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  span {
    font-size: 12px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #352c2a;
    line-height: 28px;
    opacity: 0.65;
  }
  span:before {
    content: "";
    height: 5px;
    width: 5px;
    background: #342b29;
    display: block;
    position: relative;
    border-radius: 50%;
    top: 17px;
    left: -10px;
  }
}
</style>